package cn.ekuma.odbo.mobile.helper

import cn.ekuma.odbo.mobile.base.I_BrowsableData

abstract class AbstractBrowableHelper<T>(): I_BrowsableData<T> {

    protected var currentItem:T?=null

    protected var _itemCount:Int =0

    var currentIntIndex: Int =0

    override fun moveFirst() {
        moveTo(0)
    }

    override fun movePrev() {
        moveTo(currentIntIndex-1)
    }

    override fun moveNext() {
        moveTo(currentIntIndex+1)
    }

    override fun moveLast() {
        moveTo(_itemCount-1)
    }

    override fun getCurrentElement(): T {
        return currentItem!!
    }

    override fun moveToAble(i: Int): Boolean {
        return i<0||i>=_itemCount
    }

    override fun getCurrentIndex(): Int =currentIntIndex

    override fun getItemCount(): Int=_itemCount

    override fun refreshData() {
    }
}